#include "event.h"
#include "eventqueue.h"
#include "server.h"
#include "eventdispatcher.h"

EventDispatcher::EventDispatcher(Server &server) :
    m_server(server)
{

}

EventDispatcher::~EventDispatcher()
{

}

size_t EventDispatcher::loop()
{
    while(1){
        EventPtr ev;

        m_server.eventQueue()->peekEvent(ev);

        if(!dispatch(ev)){
            break;
        }
    }

    return m_server.eventQueue()->size();
}

bool EventDispatcher::dispatch(const EventPtr &ev)
{
    return true;
}
